/*********************************************************************
* File:: TournamentTerroristAgent.h
* \brief The terrorist BDI with Communication agent.
*********************************************************************/
#pragma once
#pragma warning (disable: 4482) // Ignore non-standard extension warnings

#include "TerroristAgent.h"

//Debugging includes
#include "../util/debug.h"
#define BOMBER_POSITION 1000
#define BOMB_POSITION 2000
#define SOMEONE_NEEDS_HELP 3000

namespace agents{ 
	/**
	* \class TournamentTerroristAgent
	* \brief The terrorist BDI with Communication agent.
	*
	* \author Instituto Superior Tecnico de Lisboa, Portugal
	* \author Technical University of Lisbon, Portugal
	* 
	* \author David Simao
	* \author Jorge Pereira
	* \author Filipa Ramos
	* 
	* \version	1.0
	* \date		2008
	**/
	class TournamentTerroristAgent: public TerroristAgent{
	public:
		TournamentTerroristAgent(edict_t *enity, int model);
		~TournamentTerroristAgent();

		void newRound();

	private:

		//Beliefs
		enum Beliefs { SEE_ENEMIES, SEE_FRIENDS, HAS_BOMB, HAS_GRENADE, AT_GOAL_POINT, HAS_AMMO, 
					   HEAR_BOMB, CAN_BUY, IS_INJURED, SEE_BOMBER, SEE_BOMB,
					   IS_STUCK, SOMEONE_IN_TROUBLES, BOMBER_ACTIVE };

		int beliefs[14];

		bool bomber_at_goal;
		bool bomber_at_camp;
		bool geared_up;

		int enemyCount;
		IVision::IVisibleAgent** enemies;

		int LastCampWp;
		bool _Running;
		bool _GoingToBomb;
		bool _GoingToBombSpot;
		int minimumFollowDistance;
		bool _IsProtectingBomb;
		bool _helpingSomeone;
		
		Vector hearDirection;
		Vector bomberPosition;
		Vector bombPosition;
	
		int bomberWaypoint;
		int bombWaypoint;
		int someoneWaypoint;

		//Desires
		enum Desires { GO_PLANT_BOMB, KILL_ENEMY, PROTECT_BOMB, STAY_ALIVE, WELL_EQUIPPED, PROTECT_BOMBER,
					   SCOUT_AREA, UNSTUCK, GET_AMMO, PICKUP_BOMB, HELP_SOMEONE };

		int desires[11];


		//Intentions
		enum Intentions { GO_BUY, PLANT_BOMB, GO_TO_BOMB_SPOT, ESCAPE, LOOK_ARROUND, KILL, HUNT, GO_GUARD_BOMB,
						  FOLLOW_BOMBER, RELOAD, EXPLORE_AREA, GO_TO_BOMB_ON_FLOOR, GET_UNSTUCK, GO_FIGHT_ENEMIES };
		
		
		int intentions[14];



		//Plan Array
		std::list<Intentions> currentPlan;

		//BDI functions
		void BDIreset();
		void update_beliefs();
		void options();
		void filter_desires();
		void create_plan();
		bool reconsider();
		bool execute(int intention);
		void think();
	};
}